<?php
/**
 * CreativeRecommendationsRequest
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Sponsored Brands campaign management
 *
 * Create and manage Sponsored Brands campaigns.   To learn more about Sponsored Brands campaigns, see:   - [Sponsored Brands overview](guides/sponsored-brands/overview)  - [Sponsored Brands campaign structure](guides/sponsored-brands/campaigns/structure)  - [Get started with Sponsored Brands campaigns](guides/sponsored-brands/campaigns/get-started-with-campaigns)
 *
 * OpenAPI spec version: 4.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * CreativeRecommendationsRequest Class Doc Comment
 *
 * @category Class
 * @description Request structure of creative recommendations API.
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class CreativeRecommendationsRequest implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'CreativeRecommendationsRequest';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'asins' => 'string[]',
        'ad_format' => 'string',
        'required_recommendations' => '\AmazonAdvertisingApi\Model\RequiredRecommendations[]'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'asins' => null,
        'ad_format' => null,
        'required_recommendations' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'asins' => 'asins',
        'ad_format' => 'adFormat',
        'required_recommendations' => 'requiredRecommendations'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'asins' => 'setAsins',
        'ad_format' => 'setAdFormat',
        'required_recommendations' => 'setRequiredRecommendations'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'asins' => 'getAsins',
        'ad_format' => 'getAdFormat',
        'required_recommendations' => 'getRequiredRecommendations'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }

    const AD_FORMAT_SPONSORED_BRANDS_VIDEO = 'SPONSORED_BRANDS_VIDEO';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getAdFormatAllowableValues()
    {
        return [
            self::AD_FORMAT_SPONSORED_BRANDS_VIDEO,
        ];
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['asins'] = isset($data['asins']) ? $data['asins'] : null;
        $this->container['ad_format'] = isset($data['ad_format']) ? $data['ad_format'] : null;
        $this->container['required_recommendations'] = isset($data['required_recommendations']) ? $data['required_recommendations'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['asins'] === null) {
            $invalidProperties[] = "'asins' can't be null";
        }
        if ($this->container['ad_format'] === null) {
            $invalidProperties[] = "'ad_format' can't be null";
        }
        $allowedValues = $this->getAdFormatAllowableValues();
        if (!is_null($this->container['ad_format']) && !in_array($this->container['ad_format'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'ad_format', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['required_recommendations'] === null) {
            $invalidProperties[] = "'required_recommendations' can't be null";
        }
        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets asins
     *
     * @return string[]
     */
    public function getAsins()
    {
        return $this->container['asins'];
    }

    /**
     * Sets asins
     *
     * @param string[] $asins An array of ASINs associated with the creative. Note, do not pass an empty array, this results in an error.
     *
     * @return $this
     */
    public function setAsins($asins)
    {
        $this->container['asins'] = $asins;

        return $this;
    }

    /**
     * Gets ad_format
     *
     * @return string
     */
    public function getAdFormat()
    {
        return $this->container['ad_format'];
    }

    /**
     * Sets ad_format
     *
     * @param string $ad_format Ad format of the creative.
     *
     * @return $this
     */
    public function setAdFormat($ad_format)
    {
        $allowedValues = $this->getAdFormatAllowableValues();
        if (!in_array($ad_format, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'ad_format', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['ad_format'] = $ad_format;

        return $this;
    }

    /**
     * Gets required_recommendations
     *
     * @return \AmazonAdvertisingApi\Model\RequiredRecommendations[]
     */
    public function getRequiredRecommendations()
    {
        return $this->container['required_recommendations'];
    }

    /**
     * Sets required_recommendations
     *
     * @param \AmazonAdvertisingApi\Model\RequiredRecommendations[] $required_recommendations Required recommendations details.
     *
     * @return $this
     */
    public function setRequiredRecommendations($required_recommendations)
    {
        $this->container['required_recommendations'] = $required_recommendations;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
